﻿using FreeSql.DataAnnotations;
using GetMan.Core.Models;
using System;
using System.Collections.Generic;

namespace GetMan.Core.DB.Entities
{
    /// <summary>
    /// 节点类
    /// </summary>
    [Table(Name = "tb_nodes")]
    public class NodesEntity : SortEntity
    {
        public long WorkSpaceId
        {
            get; set;
        }

        [Navigate(nameof(WorkSpaceId))]
        public WorkSpaceEntity WorkSpace
        {
            get; set;
        }

        [Column(StringLength = 255)]
        public string NodeName
        {
            get; set;
        }

        public long ParentId
        {
            get; set;
        }
        [Navigate(nameof(ParentId))]
        public NodesEntity Parent
        {
            get; set;
        }

        [Column(StringLength = 500)]
        public string Description
        {
            get; set;
        }

        /// <summary>
        /// 节点类型
        /// </summary>
        public NodeTypeEnum NodeType
        {
            get; set;
        }

        public bool IsEnable
        {
            get; set;
        }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdateTime
        {
            get; set;
        }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime
        {
            get; set;
        }

        public ICollection<NodesEntity> Childs
        {
            get; set;
        }
    }
}